package com.tzinfo.tzt.fragment;


import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.tzinfo.tzt.R;

/**
 * Created by Administrator on 2014/11/11.
 */
public class Cars4smodeFragmentImage1 extends Fragment {
    private static final String ARG_imageUrl = "imageUrl";
    // TODO: Rename and change types of parameters
    private String imageUrl;


    private ImageLoader imageLoader;

    private ImageView image;

    private Context context;
    private int photoImageId[] = {R.drawable.a31,R.drawable.aodi,R.drawable.benchi,R.drawable.q31};

    public static Cars4smodeFragmentImage1 newInstance(String param1) {
        Cars4smodeFragmentImage1 fragment = new Cars4smodeFragmentImage1();
        Bundle args = new Bundle();
        args.putString(ARG_imageUrl, param1);

        fragment.setArguments(args);
        return fragment;
    }
    public Cars4smodeFragmentImage1() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            imageUrl = getArguments().getString(ARG_imageUrl);

        }
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        context = activity;
        imageLoader = ImageLoader.getInstance();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.cars4mode_fragment, container, false);
        image =(ImageView)v.findViewById(R.id.image);
        return v;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        imageLoader.displayImage(imageUrl, image);
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onDetach() {
        super.onDetach();
    }
}
